package com.weds.data_sync.pojo.dto;

import com.alibaba.fastjson2.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @Description 执行加护DTO
 * @Author lihw
 * @Date 2024/1/6 9:19
 */
@Schema(name = "ScriptPlanDto", description = "执行方案dto")
@Data
public class ScriptPlanDto {
    @Schema(description = "方案id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;

    @Schema(description = "方案id数据", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private List<Long> ids;

    @Schema(description = "方案编号")
    private String planNo;

    @NotBlank(message = "方案名称不能为空")
    @Schema(description = "方案名称")
    private String planName;

    @Size(message = "脚本数组不能为空", min = 1)
    @Schema(description = "脚本数组")
    private List<Integer> scriptArr;

    @NotNull(message = "执行方式不能为空")
    @Schema(description = "执行方式: 1 自动轮询 2 手动")
    private Integer runType;

    @Schema(description = "定时任务cron", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String runCron;

    @JSONField(defaultValue = "0")
    @Schema(description = "创建时是否立即执行一次", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Integer isOnce;

    @Schema(description = "是否开启回调", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Integer isCallback;

    @Schema(description = "回调方式: 1 rest 2 MQ", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String callbackType;

    @Schema(description = "回调路径", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String callbackUrl;

    @Schema(description = "路由方式: 1 topic 2 fanout 3 direct", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Integer callbackRouteType;

    @Schema(description = "回调路由交换机", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String callbackRouteExchange;

    @Schema(description = "回调路由key", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private String callbackRouteKey;
}
